package main

import (
	"database/sql"
	"fmt"

	_ "github.com/go-sql-driver/mysql"
)

func main() {
	db, err := sql.Open("mysql", "root:Nuatar171Yzy@tcp(120.25.254.189:3306)/fochan?charset=utf8&loc=Asia%2FShanghai&parseTime=true")
	defer db.Close()
	if err != nil {
		panic(err)
	}
	row, errs := db.Query("select * from user_info")
	defer row.Close()
	if errs != nil {
		panic(errs)
	}
	cols, _ := row.Columns()
	colsType, _ := row.ColumnTypes()
	for _, v := range cols {
		fmt.Print(v, " | ")
	}
	fmt.Println("-=--------------------")
	for _, v := range colsType {
		fmt.Print(v.DatabaseTypeName(), ",", v.Name(), ",", v.ScanType(), ",")
		lens, ok := v.Length()
		fmt.Print(lens, ok, " | ")
	}

}
